/*********************************************************************
	Rhapsody	: 7.6
	Login		: Ryszard
	Component	: DefaultComponent
	Configuration 	: DefaultConfig
	Model Element	: OutdoorDisplay
//!	Generated Date	: Wed, 23, Nov 2011 
	File Path	: DefaultComponent/DefaultConfig/CargoLiftSystem/OutdoorDisplay.java
*********************************************************************/

package CargoLiftSystem;

//## link itsIDisplay 
import Hardware.IDisplay;
//## auto_generated
import com.ibm.rational.rhapsody.oxf.*;
//## auto_generated
import com.ibm.rational.rhapsody.oxf.states.*;

//----------------------------------------------------------------------------
// CargoLiftSystem/OutdoorDisplay.java                                                                  
//----------------------------------------------------------------------------

//## package CargoLiftSystem 


//## class OutdoorDisplay 
public class OutdoorDisplay implements RiJStateConcept {
    
    public Reactive reactive;		//## ignore 
    
    protected int floor;		//## attribute floor 
    
    protected Controller itsController;		//## link itsController 
    
    protected Controller itsController_1;		//## link itsController_1 
    
    protected IDisplay itsIDisplay;		//## link itsIDisplay 
    
    //#[ ignore 
    public static final int RiJNonState=0;
    public static final int waiting=1;
    public static final int liftDoorOpen=2;
    public static final int idle=3;
    //#]
    protected int rootState_subState;		//## ignore 
    
    protected int rootState_active;		//## ignore 
    
    
    //## statechart_method 
    public RiJThread getThread() {
        return reactive.getThread();
    }
    
    //## statechart_method 
    public void schedTimeout(long delay, long tmID, RiJStateReactive reactive) {
        getThread().schedTimeout(delay, tmID, reactive);
    }
    
    //## statechart_method 
    public void unschedTimeout(long tmID, RiJStateReactive reactive) {
        getThread().unschedTimeout(tmID, reactive);
    }
    
    //## statechart_method 
    public boolean isIn(int state) {
        return reactive.isIn(state);
    }
    
    //## statechart_method 
    public boolean isCompleted(int state) {
        return reactive.isCompleted(state);
    }
    
    //## statechart_method 
    public RiJEventConsumer getEventConsumer() {
        return (RiJEventConsumer)reactive;
    }
    
    //## statechart_method 
    public void gen(RiJEvent event) {
        reactive._gen(event);
    }
    
    //## statechart_method 
    public void queueEvent(RiJEvent event) {
        reactive.queueEvent(event);
    }
    
    //## statechart_method 
    public int takeEvent(RiJEvent event) {
        return reactive.takeEvent(event);
    }
    
    // Constructors
    
    //## auto_generated 
    public  OutdoorDisplay(RiJThread p_thread) {
        reactive = new Reactive(p_thread);
    }
    
    //## auto_generated 
    public int getFloor() {
        return floor;
    }
    
    //## auto_generated 
    public void setFloor(int p_floor) {
        floor = p_floor;
    }
    
    //## auto_generated 
    public Controller getItsController() {
        return itsController;
    }
    
    //## auto_generated 
    public void setItsController(Controller p_Controller) {
        itsController = p_Controller;
    }
    
    //## auto_generated 
    public Controller getItsController_1() {
        return itsController_1;
    }
    
    //## auto_generated 
    public void __setItsController_1(Controller p_Controller) {
        itsController_1 = p_Controller;
    }
    
    //## auto_generated 
    public void _setItsController_1(Controller p_Controller) {
        if(itsController_1 != null)
            {
                itsController_1.__setItsOutdoorDisplay(null);
            }
        __setItsController_1(p_Controller);
    }
    
    //## auto_generated 
    public void setItsController_1(Controller p_Controller) {
        if(p_Controller != null)
            {
                p_Controller._setItsOutdoorDisplay(this);
            }
        _setItsController_1(p_Controller);
    }
    
    //## auto_generated 
    public void _clearItsController_1() {
        itsController_1 = null;
    }
    
    //## auto_generated 
    public IDisplay getItsIDisplay() {
        return itsIDisplay;
    }
    
    //## auto_generated 
    public void setItsIDisplay(IDisplay p_IDisplay) {
        itsIDisplay = p_IDisplay;
    }
    
    //## auto_generated 
    public boolean startBehavior() {
        boolean done = false;
        done = reactive.startBehavior();
        return done;
    }
    
    //## ignore 
    public class Reactive extends RiJStateReactive {
        
        // Default constructor 
        public Reactive() {
            this(RiJMainThread.instance());
        }
        
        
        // Constructors
        
        public  Reactive(RiJThread p_thread) {
            super(p_thread);
            initStatechart();
        }
        
        //## statechart_method 
        public boolean isIn(int state) {
            if(rootState_subState == state)
                {
                    return true;
                }
            return false;
        }
        
        //## statechart_method 
        public boolean isCompleted(int state) {
            return true;
        }
        
        //## statechart_method 
        public void rootState_entDef() {
            {
                rootState_enter();
                rootStateEntDef();
            }
        }
        
        //## statechart_method 
        public int rootState_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            switch (rootState_active) {
                case idle:
                {
                    res = idle_takeEvent(id);
                }
                break;
                case waiting:
                {
                    res = waiting_takeEvent(id);
                }
                break;
                case liftDoorOpen:
                {
                    res = liftDoorOpen_takeEvent(id);
                }
                break;
                default:
                    break;
            }
            return res;
        }
        
        //## auto_generated 
        protected void initStatechart() {
            rootState_subState = RiJNonState;
            rootState_active = RiJNonState;
        }
        
        //## statechart_method 
        public void idle_entDef() {
            idle_enter();
        }
        
        //## statechart_method 
        public void idleEnter() {
        }
        
        //## statechart_method 
        public int waiting_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(LiftArrived.LiftArrived_CargoLiftSystem_id))
                {
                    res = waitingTakeLiftArrived();
                }
            
            return res;
        }
        
        //## statechart_method 
        public void idle_exit() {
            idleExit();
        }
        
        //## statechart_method 
        public int liftDoorOpenTakeDoorsClosed() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            liftDoorOpen_exit();
            idle_entDef();
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public int liftDoorOpen_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(DoorsClosed.DoorsClosed_CargoLiftSystem_id))
                {
                    res = liftDoorOpenTakeDoorsClosed();
                }
            
            return res;
        }
        
        //## statechart_method 
        public int rootState_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void waitingExit() {
        }
        
        //## statechart_method 
        public void rootState_enter() {
            rootStateEnter();
        }
        
        //## statechart_method 
        public void rootStateEnter() {
        }
        
        //## statechart_method 
        public int idleTakeRequestLift() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            idle_exit();
            waiting_entDef();
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void waitingEnter() {
        }
        
        //## statechart_method 
        public void liftDoorOpen_entDef() {
            liftDoorOpen_enter();
        }
        
        //## statechart_method 
        public void idle_enter() {
            rootState_subState = idle;
            rootState_active = idle;
            idleEnter();
        }
        
        //## statechart_method 
        public void rootStateEntDef() {
            idle_entDef();
        }
        
        //## statechart_method 
        public void waiting_exit() {
            waitingExit();
        }
        
        //## statechart_method 
        public int idle_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(RequestLift.RequestLift_CargoLiftSystem_id))
                {
                    res = idleTakeRequestLift();
                }
            
            return res;
        }
        
        //## statechart_method 
        public void liftDoorOpenExit() {
        }
        
        //## statechart_method 
        public void liftDoorOpenEnter() {
        }
        
        //## statechart_method 
        public void waiting_entDef() {
            waiting_enter();
        }
        
        //## statechart_method 
        public int waitingTakeLiftArrived() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            waiting_exit();
            liftDoorOpen_entDef();
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void waiting_enter() {
            rootState_subState = waiting;
            rootState_active = waiting;
            waitingEnter();
        }
        
        //## statechart_method 
        public void rootStateExit() {
        }
        
        //## statechart_method 
        public void idleExit() {
        }
        
        //## statechart_method 
        public void liftDoorOpen_exit() {
            liftDoorOpenExit();
        }
        
        //## statechart_method 
        public void liftDoorOpen_enter() {
            rootState_subState = liftDoorOpen;
            rootState_active = liftDoorOpen;
            liftDoorOpenEnter();
        }
        
    }
}
/*********************************************************************
	File Path	: DefaultComponent/DefaultConfig/CargoLiftSystem/OutdoorDisplay.java
*********************************************************************/

